//
//  HLNetwork.m
//  TestApp
//
//  Created by dllo on 16/10/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HLNetwork.h"

@implementation HLNetwork

+ (NSURLSessionDataTask *)GET:(BaseNetworkApi *)request success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure {
    NSURLSessionDataTask *dataTask = [HLNetTool GET:request.url body:request.params header:request.header response:HLJSON successBlock:^(id result) {
        if (result) {
            success(result);
        }
    } failureBlock:^(NSError *error) {
        if (error) {
            failure(error);
        }
    }];
    return dataTask;
}

+ (NSURLSessionDataTask *)POST:(BaseNetworkApi *)request success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure
{
    NSURLSessionDataTask *dataTask = [HLNetTool POST:request.url body:request.params header:request.header response:HLJSON successBlock:^(id result) {
        if (result) {
            success(result);
        }
    } failureBlock:^(NSError *error) {
        if (error) {
            failure(error);
        }
    }];
    return dataTask;
}

@end
